import React, { Fragment } from "react";
import {Checkbox, Icon, Tooltip} from "antd";
import { connect } from "dva";
import { openNotificationWithIcon } from "utils/comm";
import BaseDuedateSetting from "./BaseDuedateSetting";
import styles from "./Pannel.less";

export const alertCodePattern = /^[a-zA-Z_][a-zA-Z_0-9-]*$/;
@connect(({ FlowChart, notice_msg: noticeModel }) => ({
  noticeTypeData: FlowChart.noticeTypeData,
  noticeThemeTypeList: noticeModel.noticeThemeTypeList,
}))
class CleanCandidateUserSetting extends BaseDuedateSetting {
  constructor(props) {
    super(props);
    this.state = {
    };
    this.openNotificationWithIcon = openNotificationWithIcon.bind(this);
  }

  render() {
    const { codeRefModel } = this.props;
    const showCheck = codeRefModel?.model.properties?.isCleanCandidateUserSetting;

    return (
      <>
        <div className={styles.content_item} style={{ display: "block" }}>
          <span className={styles.item_label} style={{ paddingBottom: 0 }}>
            <Checkbox
              checked={showCheck === '1'}
              onChange={(e) => this.onCleanCandidateUserSetting(e.target.checked)}
            >
              退回时，是否保留该节点的候选人设置
            </Checkbox>
            <Tooltip placement="topLeft" title="当流程执行回退操作且当前节点已在审批历史中时，是否要保留当前节点预指派候选人设置：默认不勾选，回退时会清除当前节点的候选人设置，回退后需要重新设置候选人（弹框选人）；勾选则是保留之前设置，回退后不需要重新设置">
              <Icon
                style={{cursor: "pointer"}}
                theme="filled"
                type="question-circle"
              />
            </Tooltip>
          </span>
        </div>
      </>
    );
  }
}

export default CleanCandidateUserSetting;
